package com.example.chaindemo.state;

import com.example.chaindemo.state.state.PublishState;

/**
 * 状态机模式的应用
 * https://nicky-chen.github.io/2018/12/19/state-machine
 */
public class Client {

    public static void main(String[] args) {
        Context context = new Context();
        context.setState(new PublishState());
        //publish --> not pay
        context.acceptOrderEvent(context);
        //not pay --> paid
        context.payOrderEvent(context);
        // 失败
        context.checkFailEvent(context);
    }

}